﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.GS
{
    class Class1
    {
        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("重疾"))
            {
                da.Value = ppa.Amount * 3;
                ppa.IsCurrentFinish = true;
                ppa.SchemePeriodActing.BasicPolicyPeriodActing.IsCurrentFinish = true;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age == 22)
            {
                da.Value = ppa.Amount * 0.5;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age == 22)
            {
                da.Value = ppa.Amount * 0.5;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            string a = ppa.PolicyActing.Policy.SelectedColRateFactors["领取年龄"];
            int receiveAge = int.Parse(a.Substring(1, 2));

            if (ppa.Age >= receiveAge)
            {
                da.Value = ppa.Amount * 0.1;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            string a = ppa.PolicyActing.Policy.SelectedColRateFactors["领取年龄"];
            int receiveAge = int.Parse(a.Substring(1, 2));

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                if (ppa.Age < receiveAge)
                {
                    da.Value = ppa.Amount * 6;
                }
                else
                {
                    da.Value = (105 - 2 * ppa.Age + receiveAge) * ppa.Amount * 0.1;
                }
                ppa.IsCurrentFinish = true;
            }

            if (ppa.Age >= receiveAge)
            {
                da.Value = ppa.Amount * 0.1;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                if (ppa.Age < 18)
                {
                    da.Description = "现金价值";
                }
                else
                {
                    da.Value = ppa.Amount;
                }
                ppa.IsCurrentFinish = true;
            }
        }
    }
}
